<template>
	<view class="box">
		<view class="item" v-for="(item, index) in list" :key="index" @click="navTo(item.id)">
			<image :src="item.pic_url[0].pic_url" mode="aspectFill"></image>
			<text class="u-line-3">{{ item.title }}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			};
		},
		methods: {
			async getList() {
				const res = await this.$request({
					url: this.$api.cases.index +
						'&page=1&region=[]&search_list=[[{"value":8,"text":"生产实力","pic_url":"","type":"class","select":true}]]&keyword=&add_cat_id=8&limit=9999'
				});
				if (res.code == 0) {
					this.list = res.data.list;
				}
			},
			navTo(id) {
				uni.navigateTo({
					url: '/pages/cases/detail?id=' + id
				});
			}
		},
		created() {
			this.getList();
		}
	};
</script>

<style lang="scss" scoped>
	.box {
		// background-color: #f6f6f6;
		padding: 20upx 20upx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		.item {
			margin-bottom: 20rpx;
			width: calc(50% - 10rpx);
			background-color: #fff;
			border-radius: 10rpx;
			overflow: hidden;
			box-shadow: rgba(0, 0, 0, 0.05) 0 0 5px 3px;

			image {
				width: 348rpx;
				height: 240rpx;
			}

			text {
				font-size: 0.8em;
				color: #737373;
				width: 100%;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				font-family: '黑体';
				padding: 10upx;
			}
		}
	}
</style>